//
//  MyScorollView.m
//  UI06__UIScrollView__相册
//
//  Created by dllo on 16/3/16.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MyScorollView.h"

@implementation MyScorollView


#pragma mark - Creating ang Init
-(instancetype)initWithFrame:(CGRect)frame withImages:(NSArray<UIImage *> *)iamges{
    self = [super initWithFrame:frame];
    if (self) {
        [self configWithFrame:frame andImages:iamges];
        
    }
    
    
    return self;
    
    
    
}

-(void)configWithFrame:(CGRect)frame andImages:(NSArray *)images{
    //设置content Size
    self.contentSize = CGSizeMake(frame.size.width * images.count, frame.size.height);
    //创建imageView子视图
    for (int i = 0; i < images.count; i++) {
        UIImageView *imageView = [[UIImageView alloc]initWithImage:images[i]];
        imageView.frame = CGRectMake(frame.size.width * i , 0, frame.size.width, frame.size.height);
        [self addSubview:imageView];
            }
    //翻页效果
    self.pagingEnabled = YES;
    
    //边缘回弹效果
    self.bounces = YES;
    //滑动指示器
    self.showsHorizontalScrollIndicator =NO;
    //添加事件
    
    
    
    
    
    
}







/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
